home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 1 / Gold Medal Software Volume 1 (Gold Medal) (1994).iso / drivers / fmsyn.arj / STMB.H < prev    next >
C/C++ Source or Header  |  1993-06-20  |  5KB  |  115 lines

  1. /* STMB.H -- Programming interface for FMSYNTH.DRV
  2.  *           Copyright (c) 1993 by Jamie O'Connell
  3.  *
  4.  * Currently four functions are defined: GetTimbre, SetTimbre, GetPercMap,
  5.  * ans SetPercMap.
  6.  * 
  7.  * Get Timbre retrieves the Timbre parameters from the specified location.
  8.  *
  9.  * SetTimbre will change the sound of an instrument in either working 
  10.  * storage or the sound of an instrument stored within a RAM Timbre Bank.
  11.  * 
  12.  * GetPercMap and SetPercMap perform equivalent functions on the internal
  13.  * percussion map: which note plays which percussion timbre at what pitch.
  14.  *
  15.  * Working storage is the current version of a Timbre stored on a 
  16.  * per-channel basis.  It is the version of the timbre which is used to
  17.  * sound a voice for the channel when a note is to be played. The working 
  18.  * storage is overwritten by Bank storage whenever a program change is 
  19.  * received for the channel.
  20.  *
  21.  * The RAM Timbre bank is either the internal Timbre Bank, or one which 
  22.  * has been loaded from a file.  In either case it is volatile storage
  23.  * which is overwritten when the bank is reloaded.
  24.  */
  25.  
  26. #ifndef  __STMB_H
  27. #define  __STMB_H
  28.  
  29. #define TMB_WORKING_STORAGE      0
  30. #define TMB_BANK_STORAGE         1
  31. #define TMB_BANK_PERCUSSION      2
  32.  
  33. #define FIRSTDRUMNOTE  35
  34. #define LASTDRUMNOTE   81
  35. #define NUMDRUMNOTES   (LASTDRUMNOTE - FIRSTDRUMNOTE + 1)
  36.  
  37. // The timbre definition (IBK - SBI Format)
  38.  
  39. typedef struct _tagTIMBRE {
  40.         BYTE MSndChr;
  41.         BYTE CSndChr;
  42.         BYTE MKSLOut;
  43.         BYTE CKSLOut;
  44.         BYTE MAtkDcy;
  45.         BYTE CAtkDcy;
  46.         BYTE MSusRel;
  47.         BYTE CSusRel;
  48.         BYTE MWavSel;
  49.         BYTE CWavSel;
  50.         BYTE FDBkCon;
  51.         BYTE PercVoc;
  52.         BYTE Future[4];
  53.         } TIMBRE;
  54.         
  55. typedef TIMBRE FAR * LPTIMBRE;
  56.  
  57. typedef struct _tagPERCMAP {
  58.         BYTE patch;                 // the patch to use 
  59.         BYTE note;                  // the note to play  
  60.         } PERCMAP;
  61.  
  62. typedef PERCMAP FAR * LPPERCMAP;
  63.  
  64. // The percussion map provides info for each pecussion MIDI key   
  65. // To access (retrieve or send) the Percussion map you create an
  66. // array of these things: PERCMAP percMap[NUMDRUMNOTES]; 
  67. // and pass it to GetPercMap or SetPercMap.  The buffer must be at least
  68. // sizeof(PERCMAP) * NUMDRUMNOTES = 94 bytes large.
  69.  
  70. extern void FAR  PASCAL GetPercMap(LPPERCMAP lpPM);
  71. extern void FAR  PASCAL SetPercMap(LPPERCMAP lpPM);
  72.  
  73. extern WORD FAR  PASCAL GetTimbre(WORD wLoc, LPTIMBRE lpTmb, WORD wSrc);
  74. extern WORD FAR  PASCAL SetTimbre(WORD wLoc, LPTIMBRE lpTmb, WORD wDest);
  75.  
  76. /*   
  77.  *  DESCRIPTION
  78.  *
  79.  *  wLoc - If the Destination (wDest) or Source (wSrc) is TMB_WORKING_STORAGE,
  80.  *         then wLoc is the channel number (0 based) for storing the Timbre.  
  81.  *         If the Destination is TMB_BANK_STORAGE, then the most
  82.  *         significant byte of wLoc (HIBYTE(wLoc)) is the Bank number
  83.  *         (valid values: 0 - 4), and the least significant byte is the
  84.  *         timbre number (0-127).
  85.  *         If the destination is TMB_PERC_BANK, the Bank number is ignored
  86.  *         (there is only one percussion bank), and the LSB is the timbre
  87.  *         number (0-46).      
  88.  *
  89.  *  lpTmb  A far pointer to a TIMBRE structure, defining the new timbre to
  90.  *         store.  The structure should be the full 16 bytes in length.
  91.  *                                                                    
  92.  *  wSrc   This value determines how wLoc is interpreted when retrieving
  93.  *         the timbre.  If wSrc is TMB_WORKING_STORAGE the timbre is retrieved
  94.  *         from working storage (wLoc is a channel number). If wSrc is 
  95.  *         TMB_BANK_STORAGE, the timbre is retrieved from the specified
  96.  *         bank and timbre slot (wLoc is the combination of Bank & Timbre#).
  97.  *
  98.  *  wDest  This value determines how wLoc is interpreted and the final 
  99.  *         destination for the timbre.  If wDest is ST_WORKING_STORAGE the
  100.  *         channel timbre info is updated, and future voices on channel will
  101.  *         sound this timbre. If wDest is ST_BANK_STORAGE, both the Bank
  102.  *         Timbre, and any channels set to this Bank and Timbre are updated.
  103.  *         Any future notes playing this bank and timbre will sound the 
  104.  *         timbre.
  105.  *                                                             
  106.  *  Return Value
  107.  *         If all goes well, 0 is returned, otherwise a non-zero value is
  108.  *         returned indicating, an incorrect or out-of-range parameter.  
  109.  *         The values within the TIMBRE structure itself are not checked
  110.  *         for validity, but stored as supplied.
  111.  */
  112.    
  113.  
  114. #endif
  115.